package com.ucap.weking.guangan.dialog;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;


/**
 * Created by weking on 2017/11/20.
 */

public class NotificationDialog extends AlertDialog {
    public NotificationDialog(Context context) {
        super(context);
    }

    public NotificationDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public NotificationDialog(Context context, int themeResId) {
        super(context, themeResId);
    }


    public static void showDialog(Context ctx, final OnPositiveClickListener onPositiveClickListener) {
        final NotificationDialog.Builder builder = new Builder(ctx);
        builder.setTitle("警告");
        builder.setMessage("需要开启通知才能接受到最新的推送消息！");
        builder.setNegativeButton("取消", new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
            }
        });
        builder.setPositiveButton("去开启", new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (onPositiveClickListener != null) {
                    onPositiveClickListener.onClick();
                }
            }
        });
        builder.show();
    }

    public interface OnPositiveClickListener {
        void onClick();
    }
}
